﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
using Yugi.Client.WebSerive;
using System.Collections;

namespace Yugi.Client.ViewModel
{
    public class RoomModel
    {
        public List<TableInfo> tableinfo_s { get; set; }
        public List<PlayerInfo> user_s { get; set; }
        public IInvoke Presenter { get; set; }
        public void ReceiveMessageFromSupervisor(MSG_GSM Message, params object[] param)
        {

            
              
        }

        public TableInfo GetTableInfo(int tableid)
        {
            foreach (var i in tableinfo_s)
                if (i.TableID == tableid)
                    return i;
            return null;
        }
        public void AddTableInfo(TableInfo tableinfo)
        {
            tableinfo_s.Add(tableinfo);
        }
        public void RemoveTableInfo(int tableid)
        {
            foreach (var i in tableinfo_s)
                if (i.TableID == tableid)
                {
                    tableinfo_s.Remove(i);
                    return;
                }
        }

        public void AddUser(PlayerInfo item)
        {
            user_s.Add(item);
        }

        public void RemoveUser(int playerid)
        {
            foreach(var i in user_s)
                if (i.ID == playerid)
                {
                    user_s.Remove(i);
                    return;
                }
        }
    }
}
